package com.lorenzogao.pley.ui.activity


import android.Manifest
import com.bumptech.glide.RequestManager
import com.lorenzogao.pley.R
import com.lorenzogao.pley.common.util.PermissionUtil
import com.lorenzogao.pley.ui.adapter.ViewPagerAdapter
import com.lorenzogao.pley.ui.base.BaseActivity
import com.lorenzogao.pley.ui.di.component.AppComponent
import com.lorenzogao.pley.ui.presenter.BasePresenter
import io.reactivex.functions.Consumer
import kotlinx.android.synthetic.main.app_bar_main.*


class AppManagerActivity : BaseActivity<BasePresenter<*, *>>() {


    private var glideRequest: RequestManager? = null

    override fun initView() {

    }


    override fun setupActivityComponent(appComponent: AppComponent) {

    }


    override fun setLayout(): Int {

        return R.layout.activity_app_manager
    }


    override fun initData() {

        PermissionUtil.requestPermission(this, Manifest.permission.READ_PHONE_STATE).subscribe(Consumer<Boolean> { aBoolean ->
            if (aBoolean) {
                initTabLayout()

            }
        })



    }


    private fun initTabLayout() {
        var mAdapter = ViewPagerAdapter(supportFragmentManager)
        view_pager.adapter = mAdapter
        view_pager.offscreenPageLimit = mAdapter.count
        tab_layout.setupWithViewPager(view_pager)


    }










    override fun onDestroy() {
        super.onDestroy()
//        RxBus.get().unregister(this)
    }


}

